<?php
include_once "settings.php";

$langList = array(
	"ru" => "russian",
);

$array = array(1, 1, 1, 1,  1, 8 => 1,  4 => 1, 19, 3 => 13);

$connection = new mysqli($host, $user, $password, $dbname, $port, $socket);
if ($connection->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); }
$connection->set_charset("utf8");

$res = $connection->query('select * from langList');

file_put_contents("lang.php", "<?php " . PHP_EOL . " \$langList = array(" . PHP_EOL , LOCK_EX);

$stringLang="";

while($row = $res->fetch_array())
{
	// $langList[$row["langCode"]] = $row['langNativeName'];
	$stringLang = $stringLang . "\"" . $row["langCode"] . "\" => \"" . $row["langNativeName"] . "\"," . PHP_EOL ;
}

$stringLang = mb_substr($stringLang,0,-3) ;

file_put_contents("lang.php", $stringLang .");" . PHP_EOL . " ?>", FILE_APPEND | LOCK_EX);


?>